﻿<%@ Page Title="New Supplier" Language="C#" MasterPageFile="~/Pages/admin/adminMaster.Master" AutoEventWireup="true" CodeBehind="NewSupplier.aspx.cs" Inherits="WarehouseWebAPP.Pages.admin.New_Entities.NewSupplier" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1">
    <tr>
        <td>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:DetailsView ID="VendorDetailsView" runat="server" 
                AutoGenerateRows="False" CellPadding="4" DataKeyNames="supplier_num" 
                DataSourceID="VendorObjectDataSource" DefaultMode="Insert" ForeColor="#333333" 
                GridLines="None" Height="50px" Width="479px">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <Fields>
                            <asp:BoundField DataField="supplier_num" HeaderText="supplier_num" 
                        ReadOnly="True" SortExpression="supplier_num" Visible="False" />
                            <asp:TemplateField HeaderText="Supplier Name" SortExpression="supplier_name">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("supplier_name") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("supplier_name") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                ErrorMessage="Already Exist" 
                                onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("supplier_name") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="supplier_address" HeaderText="Address" 
                        SortExpression="supplier_address" />
                            <asp:TemplateField HeaderText="Phone No." SortExpression="supplier_phone">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("supplier_phone") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("supplier_phone") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="TextBox2" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                ControlToValidate="TextBox2" ErrorMessage="Invalid Phone No." 
                                
                                
                                
                                        ValidationExpression="^0[23489]{1}(\-)?[^0\D]{1}\d{6}$|^0(5[012345678]){1}(\-)?\d{7}$"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("supplier_phone") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="E-mail Address" SortExpression="supplier_email">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("supplier_email") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("supplier_email") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ControlToValidate="TextBox3" ErrorMessage="*"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ControlToValidate="TextBox3" ErrorMessage="Invalid E-mail" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("supplier_email") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="supplier_contact_person" HeaderText="Contact Person Name" 
                        SortExpression="supplier_contact_person" />
                            <asp:TemplateField HeaderText="Contact Person Phone" 
                        SortExpression="supplier_contact_phone">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" 
                                Text='<%# Bind("supplier_contact_phone") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" 
                                Text='<%# Bind("supplier_contact_phone") %>'></asp:TextBox>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="TextBox4" ErrorMessage="Invalid Phone No." 
                                
                                
                                        ValidationExpression="^0[23489]{1}(\-)?[^0\D]{1}\d{6}$|^0(5[012345678]){1}(\-)?\d{7}$"></asp:RegularExpressionValidator>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" 
                                Text='<%# Bind("supplier_contact_phone") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowInsertButton="True" />
                        </Fields>
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:DetailsView>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:ObjectDataSource ID="VendorObjectDataSource" runat="server" 
                InsertMethod="SupplierInsert" SelectMethod="SupplierGet" 
                TypeName="WarehouseWebAPP.code.BLL.SupplierBLL" 
                OldValuesParameterFormatString="original_{0}">
                <InsertParameters>
                    <asp:Parameter Name="supplier_name" Type="String" />
                    <asp:Parameter Name="supplier_address" Type="String" />
                    <asp:Parameter Name="supplier_phone" Type="String" />
                    <asp:Parameter Name="supplier_email" Type="String" />
                    <asp:Parameter Name="supplier_contact_person" Type="String" />
                    <asp:Parameter Name="supplier_contact_phone" Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
        </td>
    </tr>
</table>
</asp:Content>
